import json


def read_txt(filename):
    f = open(filename, 'r', encoding='utf-8')
    text_list_ = [line.strip('\n') for line in f.readlines()]
    f.close()
    return text_list_


if __name__ == '__main__':
    input_path = "F:/CPP/ZDataFrame/test_dataframe/t6_1.txt"
    text_list = read_txt(input_path)
    dict_line = json.loads(text_list[0])
    for i, line in enumerate(dict_line):
        words = line["words"]
        position = line["position"]

        x0 = position["left"]
        y0 = position["top"]
        width = position["width"]
        height = position["height"]
        x1 = x0 + width
        y1 = y0 + height
        print("{" + f"{i}, {x0}, {y0}, {x1}, {y1}, {width}, {height}" + ", L\"" + f"{words}" + "\", L\"\"},")